import { http } from '@/utils/request'

// 考试列表(模拟, 综合, 专题)[x]
export function selectMyExamList(params: {
  topicId?: number | string
  examType?: number | string
  pageNumber: number
  pageSize: number
}) {
  return http.request({
    url: `/small/exam/selectMyExamList/${params.examType}`,
    method: 'GET',
    params
  })
}

// 轮播图[x]
export function selectExamImg() {
  return http.request({
    url: `small/exam/selectExamImg`,
    method: 'GET'
  })
}

// 我的试卷
export function myExamPaper(params: { examId: number | string | null }) {
  return http.request({
    url: `/small/exam/paper`,
    method: 'GET',
    params
  })
}

// 我的考试
export function myExamGet(params: { examId: number | string | null }) {
  return http.request({
    url: `/small/exam/get`,
    method: 'GET',
    params
  })
}

// 生成试卷
export function generatePaper(params: { examId: number | string }) {
  return http.request({
    url: `/small/exam/generatePaper`,
    method: 'GET',
    params
  })
}

// 交卷
export function myExamFinish(params: { examId: number | string | null }) {
  return http.request({
    url: `/small/exam/finish`,
    method: 'GET',
    params
  })
}

// 考试
export function myExamExamGet(params: { examId: number | string | null }) {
  return http.request({
    url: `/small/exam/examGet`,
    method: 'GET',
    params
  })
}

// 答题
export function myExamAnswer(data: {
  examId: number | string | null
  questionId?: number | string
  answers: Array<string>
}) {
  return http.request({
    url: `/small/exam/answer`,
    method: 'POST',
    data
  })
}
